#include <iostream>
#include <algorithm>

using namespace std;

typedef struct
{
    int l;
    int w;
} node;

node ipt[5120] = {};
node dp[5120] = {};

bool compare(node a, node b)
{
    if (a.l >= b.l && a.w >= b.w)
    {
        return true;
    }
    if (a.l * a.w > b.l * b.w)
    {
        return true;
    }
    return false;
}

int main(int argc, char const *argv[])
{
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> ipt[i].l >> ipt[i].w;
    }
    
    sort(ipt + 1, ipt + 1 + n, compare);

    dp[1] = 1;

    for (int i = 1; i <= n; i++)
    {
        int mn = 12345;
        for (int j = 1; j <= n; j++)
        {
            
        }
    }

    int j;
    for (j = 0; dp[j].l != 12345; j++);
    cout << j;
    return 0;
}
